package com.chazz.dao.impl;

import com.chazz.dao.Sku2Dao;
import com.chazz.entity.Sku;
import com.chazz.utils.DBUtils;
import java.sql.ResultSet;
import java.sql.SQLException;

/**
 * 描述:chenxiao
 *
 * @author Chazz
 * @create 2020-09-26 20:44
 */
public class Sku2DaoImpl extends GenericDaoImpl<Sku,Integer> implements Sku2Dao  {
    @Override
    public Sku findByGid(Integer gid) {
        Sku sku = null;
        String sql = "SELECT * FROM sku WHERE goodsid=?";
        ResultSet rs = DBUtils.executeQuery(sql,gid);
        try{
            while(rs.next()){
                sku = reflectUtils.newInstance(Sku.class,rs);
            }
        }catch (SQLException ex){
            ex.printStackTrace();
        }
        return sku;
    }
}
